{include file='pub/header'/}
<title>新增商品属性值</title>
</head>
<body>
<div class="page-container">
    <form class="form form-horizontal">
        <input type="hidden" name="prop_value_id" id="" value="{$item.id}">
        <input type="hidden" name="prop_id" value="{$prop_id}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>属性名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$prop_name}" placeholder="" name="prop_name" disabled>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>属性值：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$item.prop_val}" placeholder="" name="prop_val">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button class="btn btn-secondary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存
                </button>
                <button onClick="layer_close();" class="btn btn-default radius" type="button">
                    &nbsp;&nbsp;取消&nbsp;&nbsp;
                </button>
            </div>
        </div>
    </form>
</div>
{include file="pub/footer"/}

<script type="text/javascript">
    $(function () {
        $("form").validate({
            rules: {
                prop_val: {
                    required: true
                },
            },
            messages: {
                prop_val: {
                    required: '分类名称不能为空'
                },
            },
            onkeyup: false,
            focusCleanup: true,
            success: "valid",
            submitHandler: function (form) {
                $(form).ajaxSubmit({
                    type: 'post',
                    url: '{:url("Product/propValueAdd")}',
                    success: function (res) {
                        if (1 == res.code) {
                            var index = parent.layer.getFrameIndex(window.name);
                            layer.msg(res.msg, {icon: 6, time: 1000});
                            setTimeout(function () {
                                parent.location.reload();
                                parent.layer.close(index);
                            }, 1000);
                        } else {
                            layer.msg(res.msg, {icon: 5, time: 1000});
                        }
                    }
                });

            }
        });
    });
</script>
</body>
</html>